﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;

namespace LCL.XPing
{
    internal static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            bool flag;
            using (Mutex mutex = new Mutex(false, "PingMg", out flag))
            {
                if (flag)
                {
                    Application.Run(new PingPanel());
                }
                else
                {
                    IntPtr intPtr = NativeMethods.FindWindow(null, "Ping工具");
                    NativeMethods.ShowWindow(intPtr, 5u);
                    NativeMethods.SetForegroundWindow(intPtr);
                    mutex.Dispose();
                }
            }
        }
    }
}
